/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __LIB3D_HARD_DIRECTX8_TEXTURE_H__
#define __LIB3D_HARD_DIRECTX8_TEXTURE_H__

#include <lib3d/hard/Texture.h>
#include "Dependent.h"
#include <d3d9.h>

namespace liba
{
namespace lib3d
{
namespace hard
{
namespace directx8
{
class Hardware;

class Texture : public hard::Texture, public Dependent
{
protected:
	static D3DTRANSFORMSTATETYPE transform_mapper[8];
	IDirect3DTexture9 * texture;
	bool valid_flag;
	int dec_scale;
	void * lockedData;
public:
	explicit Texture(Hardware * hardware, int mipmap_levels, const pictureformat::Format & desired_format, D3DFORMAT hardware_format, int width, int height, int max_texture_size );
	virtual ~Texture();
	virtual void * lock(int mipmap_level, int * stride);
	virtual void unlock(int mipmap_level);
	virtual bool is_valid();
	virtual bool set_in_hardware(int stage);

	virtual void invalidate();
	virtual void release();
};


} // namespace directx8
} // namespace hard
} // namespace lib3d
} // namespace liba
using namespace liba;

#endif //__LIB3D_HARD_DIRECTX8_TEXTURE_H__